#ifndef __server_socket_h__
#define __server_socket_h__

#include <sys/types.h>          /* See NOTES */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>

#include "sp_epoll.h"

#define EPOLL_FD 0
#define STDIN_FD  1
#define SOCKET_FD 2


#define STDIN_DATA 11
#define SOCKET_DATA 12


#define INVALID_SOCKET -1

#define BUFMAX 1024
#define FDMAX  128

typedef struct session_t
{
	int fds[FDMAX];	//0 is efd, 1 is connfd, 2 is stdin fd
	
	char buf[BUFMAX];
	int bsize;
	int msize;
	
	int maxfd;
}session;



/*
 对外部提供的接口
*/
int create_connect_socket(const char *ip, const short port);
void init_socket_server(session *s, int fd, int STDIN);
void server_send(session *ss);
void server_recv(session *ss);
int server_wait(session *ss);



#endif





